
import org.apache.commons.beanutils.PropertyUtils;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.List;

@Service
public class SysPhoneTextMessageServiceImpl implements SysPhoneTextMessageService  {

    @Resource
    private SysPhoneTextMessageMapper sysPhoneTextMessageMapper;

    /**
     * 获取 SysPhoneTextMessage 分页列表
     */
    @Transactional
    public IPage getSysPhoneTextMessagePagination( PaginationVo paginationVo, SysPhoneTextMessageQuery sysPhoneTextMessageQuery ) throws Exception {

        IPage page = new Page( paginationVo.getPageIndex(), paginationVo.getPageSize() );
        LambdaQueryWrapper<SysPhoneTextMessageEntity> lqs = new LambdaQueryWrapper();
        sysPhoneTextMessageMapper.selectPage(page, lqs);

        List<SysPhoneTextMessageEntity> record = page.getRecords();
        if( !ObjectUtil.isNotEmptyList(record)){
            return page;
        }
        return null;
    }


    /**
     * 获取 SysPhoneTextMessage 所有数据
     *
    */
    @Transactional
    public List<SysPhoneTextMessageEntity> getSysPhoneTextMessageAllList( SysPhoneTextMessageQuery sysPhoneTextMessageQuery ) throws Exception {

        LambdaQueryWrapper<SysPhoneTextMessageEntity> lqs = new LambdaQueryWrapper();
        List<SysPhoneTextMessageEntity> list = sysPhoneTextMessageMapper.selectList(lqs);
        return list;
    }


    /**
     * 获取 SysPhoneTextMessage 详情
    */
    @Transactional
    public SysPhoneTextMessageEntity getSysPhoneTextMessageDetail( Long id) throws Exception {

        SysPhoneTextMessageEntity sysPhoneTextMessage = sysPhoneTextMessageMapper.selectById(id);
        return sysPhoneTextMessage;
    }


    /**
     * 新增 SysPhoneTextMessage
     * */
    @Transactional
    public void addSysPhoneTextMessage(SysPhoneTextMessageVo sysPhoneTextMessageVo) throws Exception {

        SysPhoneTextMessageEntity sysPhoneTextMessage = new SysPhoneTextMessageEntity();
        ReflectionCopy.copyProperties( sysPhoneTextMessage, sysPhoneTextMessageVo );
        sysPhoneTextMessageMapper.insert(sysPhoneTextMessage);
        return;
    }


    /**
     * 更新 SysPhoneTextMessage
     * */
    @Transactional
    public void updateSysPhoneTextMessage( SysPhoneTextMessageVo sysPhoneTextMessageVo) throws Exception {

        if( sysPhoneTextMessageVo.getId() == null ){
            throw GlobalException.gen(10021, "id不存在");
        }
        SysPhoneTextMessageEntity sysPhoneTextMessage = new SysPhoneTextMessageEntity();
        ReflectionCopy.copyProperties( sysPhoneTextMessage, sysPhoneTextMessageVo );
        sysPhoneTextMessageMapper.updateById(sysPhoneTextMessage);
        return;
    }

    /**
     * 删除 SysPhoneTextMessage
     * */
    @Transactional
    public void batchRemoveSysPhoneTextMessage( List<Long> ids ) throws Exception {


        if( !ObjectUtil.isNotEmptyList(ids) ){
            throw GlobalException.gen(10011, "要删除的id不存在");
        }
        sysPhoneTextMessageMapper.deleteBatchIds(ids);
    }

}

      